---
title: clsLegacyTaskCodeCollection
summary: API reference for clsLegacyTaskCodeCollection.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Business.Tasks.Claim
reference_type: embedded
---

# clsLegacyTaskCodeCollection

`clsLegacyTaskCodeCollection` loads the entire `LEGACY_TASK_CODE` reference table in one unfiltered `SELECT *` and exposes it as a read-only, code-lookup collection.

## Purpose
- Loads all legacy task code rows in a single retrieval ([Load the legacy task code table](../../operations/op-16-load-legacy-task-code-table.md), [SQL-002](../../sql/SQL-002-legacy-task-code-select.md)).
- Provides membership and lookup access over the loaded code set without exposing any write path ([BR-LTC-01](../../business-rules.md#br-ltc-01-legacy-task-codes-are-read-only)).

## Context
- Namespace: `SAIF.Business.Tasks.Claim`
- Assembly/package: `SAIF.Business.Tasks.Claim.dll` (embedded)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Item(Integer)` | `Public Default ReadOnly Property Item(index As Integer) As clsLegacyTaskCode` | Returns the row at the given ordinal position. |
| `Item(legacyTaskCode As String)` | `Public Overloads ReadOnly Property Item(legacyTaskCode As String) As clsLegacyTaskCode` | Returns the row matching the given legacy task code natural key. |
| `MyCriteria` | `Public Property MyCriteria As Criteria` | Exposes the criteria object holding the single inline `RetrieveSQL` for the code table. |
| `Shared GetLegacyTaskCodeCollection(dpi)` | `Public Shared Function GetLegacyTaskCodeCollection(dpi As IDataPortalInfo) As clsLegacyTaskCodeCollection` | Factory that loads the entire code table ([Load the legacy task code table](../../operations/op-16-load-legacy-task-code-table.md)). |
| `Shadows Add(clsLegacyTaskCode)` | `Public Shadows Sub Add(row As clsLegacyTaskCode)` | Adds a row to the in-memory collection during load. |
| `Contains(clsLegacyTaskCode)` | `Public Overloads Function Contains(row As clsLegacyTaskCode) As Boolean` | Reports whether the collection contains the given row instance. |
| `Contains(String)` | `Public Overloads Function Contains(legacyTaskCode As String) As Boolean` | Reports whether the collection contains a row matching the given code. |
| `Overrides BeforeRetrieve` | `Protected Overrides Sub BeforeRetrieve(...)` | Creates the data request and assigns `MyCriteria.RetrieveSQL` ([SQL-002](../../sql/SQL-002-legacy-task-code-select.md)). |
| `Overrides AfterRetrieve` | `Protected Overrides Sub AfterRetrieve(...)` | Iterates the returned reader, building, loading, and adding each `clsLegacyTaskCode` row. |

## Behavioral notes
- `Add` is declared `As Integer` but has no `Return` statement (the compiler warning is suppressed by the project's `NoWarn` list), so it always returns 0; whether callers depend on the returned index is unknown.**
- Both `Contains(String)` overloads compare a `clsLegacyTaskCode` against a `String` via `Equals`, which always returns `False` — this appears to be a code-generation defect rather than intended behavior.*

## Constraints and usage notes
- All non-`RetrieveSQL` properties on `Criteria` throw `ApplicationException(clsConstants.Messages.InvalidSQLProperty)`, enforcing read-only access ([BR-LTC-01](../../business-rules.md#br-ltc-01-legacy-task-codes-are-read-only)).
- There is no factory path that filters by code — every call loads the full table.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- SAIF.Business.Tasks.Claim/clsLegacyTaskCodeCollection.vb
